package com.kn.order.controller;

import com.kn.common.model.R;
import com.kn.common.valid.AddGroup;
import com.kn.order.model.Extra;
import com.kn.order.service.ExtraService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;

@RestController
@RequestMapping("extra/extra")
@RequiredArgsConstructor
@CrossOrigin
public class ExtraController {
    private final ExtraService extraService;
   /* @PostMapping
    public R add(@Validated(AddGroup.class) @RequestBody Extra extra){
        return extraService.add(extra);
    }*/

 /*   @PostMapping("save")
    public R save(@RequestParam(value = "file", required = false) MultipartFile file, Extra extra) {
        return extraService.save(file,extra);
    }

    @PostMapping("delete")
    public R delete(Long id) {
        return extraService.delete(id);
    }

    @GetMapping("listall")
    public List<Extra> listall(@RequestParam(value = "orderid" ,required = true) Long orderid) {
        return extraService.listall(orderid);
    }

    @RequestMapping("downloadFile")
    public R downloadFile(HttpServletResponse response, Long id){
        return extraService.downloadFile(response,id);
    }*/
}
